@echo off
cls
echo Prunus Framework                                       http://www.7dedos.com.ar
echo Creacion del Sandbox
echo -------------------------------------------------------------------------------
set origen=e:\web\prunus
set destino=e:\web\sandbox

:validarOrigen
choice /C:sn /m "Origen: %origen% - Ok?"
if errorlevel 2 goto pedirOrigen
if errorlevel 1 goto validarDestino
:pedirOrigen
set /p origen="Ingrese nuevo path de origen: "
goto validarOrigen

:validarDestino
choice /C:sn /m "Destino: %destino% - Ok?"
if errorlevel 2 goto pedirDestino
if errorlevel 1 goto Instalar
:pedirDestino
set /p destino="Ingrese nuevo path de destino: "
goto validarDestino

:Instalar
echo Creando Estructura...
rmdir /s /q %destino%\application
rmdir /s /q %destino%\webroot
md %destino%\application
md %destino%\application\config
md %destino%\application\controllers
md %destino%\application\controllers\prunus
md %destino%\application\hooks
md %destino%\application\language
md %destino%\application\language\spanish
md %destino%\application\language\english
md %destino%\application\libraries
md %destino%\application\libraries\ofc
md %destino%\application\libraries\font
md %destino%\application\models
md %destino%\application\views
md %destino%\application\views\prunus
md %destino%\webroot
md %destino%\webroot\css
md %destino%\webroot\css\pr
md %destino%\webroot\css\prce
md %destino%\webroot\css\profc
md %destino%\webroot\css\pr_out
md %destino%\webroot\images
md %destino%\webroot\javascripts
md %destino%\webroot\static
md %destino%\webroot\flash

echo Copiando Archivos...
copy /v %origen%\application\config\prunus_core.php %destino%\application\config\prunus_core.php > nul 
copy /v %origen%\application\config\prunus_almendro.php %destino%\application\config\prunus_almendro.php > nul 
copy /v %origen%\application\config\prunus_cerezo.php %destino%\application\config\prunus_cerezo.php > nul 
copy /v %origen%\application\config\prunus_damasco.php %destino%\application\config\prunus_damasco.php > nul 
copy /v %origen%\application\config\prunus_ofc.php %destino%\application\config\prunus_ofc.php > nul 
copy /v %origen%\application\controllers\prunus\auth.php %destino%\application\controllers\prunus\auth.php > nul 
copy /v %origen%\application\controllers\prunus\idioma.php %destino%\application\controllers\prunus\idioma.php > nul 
copy /v %origen%\application\controllers\prunus\index.html %destino%\application\controllers\prunus\index.html > nul 
copy /v %origen%\application\hooks\prunus_core.php %destino%\application\hooks\prunus_core.php > nul 
copy /v %origen%\application\language\spanish\prunus_lang.php %destino%\application\language\spanish\prunus_lang.php > nul 
copy /v %origen%\application\language\english\prunus_lang.php %destino%\application\language\english\prunus_lang.php > nul 
copy /v %origen%\application\libraries\prunus_core.php %destino%\application\libraries\prunus_core.php > nul 
copy /v %origen%\application\libraries\prunus_almendro.php %destino%\application\libraries\prunus_almendro.php > nul 
copy /v %origen%\application\libraries\prunus_cerezo.php %destino%\application\libraries\prunus_cerezo.php > nul 
copy /v %origen%\application\libraries\prunus_damasco.php %destino%\application\libraries\prunus_damasco.php > nul 
copy /v %origen%\application\libraries\prunus_ofc.php %destino%\application\libraries\prunus_ofc.php > nul 
copy /v %origen%\application\libraries\fpdf.php %destino%\application\libraries\fpdf.php > nul 
copy /v %origen%\application\libraries\ofc\*.* %destino%\application\libraries\ofc > nul 
copy /v %origen%\application\libraries\font\*.* %destino%\application\libraries\font > nul 
copy /v %origen%\application\models\prunus_model.php %destino%\application\models\prunus_model.php > nul 
copy /v %origen%\application\views\prunus\login_form.php %destino%\application\views\prunus\login_form.php > nul 

copy /v %origen%\webroot\.htaccess %destino%\webroot\.htaccess > nul 
copy /v %origen%\webroot\favicon.gif %destino%\webroot\favicon.gif > nul 
copy /v %origen%\webroot\favicon.ico %destino%\webroot\favicon.ico > nul 
copy /v %origen%\webroot\index.php %destino%\webroot\index.php > nul 
copy /v %origen%\webroot\static\permisos.php %destino%\webroot\static\permisos.php > nul 
copy /v %origen%\webroot\javascripts\jquery.js %destino%\webroot\javascripts\jquery.js > nul 
copy /v %origen%\webroot\javascripts\jquery.editinplace.js %destino%\webroot\javascripts\jquery.editinplace.js > nul 
copy /v %origen%\webroot\javascripts\jquery.popup.js %destino%\webroot\javascripts\jquery.popup.js > nul 
copy /v %origen%\webroot\javascripts\swfobject.js %destino%\webroot\javascripts\swfobject.js > nul 
copy /v %origen%\webroot\javascripts\json2.js %destino%\webroot\javascripts\json2.js > nul 

copy /v %origen%\webroot\images\ajax-loader.gif %destino%\webroot\images\ajax-loader.gif > nul 
copy /v %origen%\webroot\images\flag-ar.gif %destino%\webroot\images\flag-ar.gif > nul 
copy /v %origen%\webroot\images\flag-us.gif %destino%\webroot\images\flag-us.gif > nul 

copy /v %origen%\webroot\css\ci_profiler.php %destino%\webroot\css\ci_profiler.php > nul 
copy /v %origen%\webroot\css\pr_out.php %destino%\webroot\css\pr_out.php > nul 
copy /v %origen%\webroot\css\pr_out_ie.php %destino%\webroot\css\pr_out_ie.php > nul 
copy /v %origen%\webroot\css\prce\actions.gif %destino%\webroot\css\prce\actions.gif > nul 
copy /v %origen%\webroot\css\profc\actions.gif %destino%\webroot\css\profc\actions.gif > nul 
copy /v %origen%\webroot\css\pr_out\top.gif %destino%\webroot\css\pr_out\top.gif > nul 
copy /v %origen%\webroot\css\pr_out\bkg.gif %destino%\webroot\css\pr_out\bkg.gif > nul 
copy /v %origen%\webroot\css\prunus_almendro.php %destino%\webroot\css\prunus_almendro.php > nul 
copy /v %origen%\webroot\css\prunus_cerezo.php %destino%\webroot\css\prunus_cerezo.php > nul 
copy /v %origen%\webroot\css\prunus_damasco.php %destino%\webroot\css\prunus_damasco.php > nul 
copy /v %origen%\webroot\css\prunus_ofc.php %destino%\webroot\css\prunus_ofc.php > nul 
copy /v %origen%\webroot\flash\open-flash-chart.swf %destino%\webroot\flash\open-flash-chart.swf > nul 

choice /C:sn /m "Overwrite language files?"
if errorlevel 2 goto appendHooks
copy /v %origen%\application\language\spanish\*.* %destino%\application\language\spanish > nul 
copy /v %origen%\application\language\english\*.* %destino%\application\language\english > nul 

:appendHooks
choice /C:sn /m "Append en Hooks.php?"
if errorlevel 2 goto appendAutoload
copy %destino%\application\config\hooks.php /B + %origen%\_instalador\hooks.prunus /B %destino%\application\config\hooks.php.2 /B  > nul 
del %destino%\application\config\hooks.php
ren %destino%\application\config\hooks.php.2 hooks.php

:appendAutoload
choice /C:sn /m "Append en Autoload.php?"
if errorlevel 2 goto appendConfig
copy %destino%\application\config\autoload.php /B + %origen%\_instalador\autoload.prunus /B %destino%\application\config\autoload.php.2 /B  > nul 
del %destino%\application\config\autoload.php
ren %destino%\application\config\autoload.php.2 autoload.php

:appendConfig
choice /C:sn /m "Append en Config.php?"
if errorlevel 2 goto fin
copy %destino%\application\config\config.php /B + %origen%\_instalador\config.prunus /B %destino%\application\config\config.php.2 /B  > nul 
del %destino%\application\config\config.php
ren %destino%\application\config\config.php.2 config.php

:fin
echo -------------------------------------------------------------------------------
echo Deploy finalizado
pause 
